package net.srcz.jsjvm.core;

import org.objectweb.asm.Type;

public class ConstantConverter {

	public static String convert(Object cst) {
		if(cst instanceof Type)
			return "vm.getClasse(\'"+(""+cst).substring(1).replaceAll(";","").replaceAll("'", "\\'")+"\')";
		if(cst != null && cst instanceof String)
			return "\'"+((String)cst).replaceAll("'", "\\'")+"\'";
		return ""+cst;
	}
}
